package com.itheima.reggie.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.reggie.dto.DishDTO;
import com.itheima.reggie.entity.Dish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface DishMapper extends BaseMapper<Dish> {
    @Select("select d.*, c.name categoryName from dish d join category c on d.category_id = c.id ${ew.customSqlSegment}")
    Page<DishDTO> selectPageCustom(Page<DishDTO> pageInfo, @Param(Constants.WRAPPER) QueryWrapper<Dish> queryWrapper);
}
